package com.tong.cloud.example.manager;

import com.tong.cloud.cache.CacheExpire;
import com.tong.support.utils.DateUtils;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("cache")
public class CacheManagerController {
    @Cacheable(value = "item1")
    @GetMapping("/item1")
    public String item1(String key) {
        return DateUtils.nowDateTime();
    }

    @CacheExpire(value = 40)
    @Cacheable(value = "item2")
    @GetMapping("/item2")
    public String item2(String key) {
        return DateUtils.nowDateTime();
    }
}
